1. Field of the Invention
Embodiments of the present invention relate generally to event reporting during graphics processing and more specifically to a system and method for using hierarchical multi-precision pipeline counters for event reporting.
2. Description of the Related Art
Graphics application programming interfaces (“APIs”) such as DirectX10™ allow the API to poll the graphics hardware to determine how many events of a specified type have occurred since the graphics hardware was last polled for that event type. The process of polling the graphics hardware includes the steps of the API issuing a command to the graphics hardware, and the graphics hardware responding to the command by reading an internal register and storing the value of the internal register into a memory location specified by the API.
Certain event types that can be polled are generated in locations from which it is impractical to report the results. One example is the reporting of the “Z pass pixel count,” which represents the number of Z pixels that pass the Z test. Importantly, some of the Z pixels that pass the test are culled near the top of the pipeline and never reach the end of the pipeline, so a counter at the end of the pipeline, where the results can be conveniently communicated to the API, is incapable of counting these Z pixels.
FIG. 1 illustrates a conventional event reporting mechanism in a programmable graphics processing pipeline 100 that provides a solution to this problem. As shown, the programmable graphics processing pipeline 100 includes execution pipelines 102 and 104 and a crossbar 106. The execution pipeline 102 includes multiple stages, shown here as a first stage 108, a second stage 110, a third stage 112 that includes an event detector 114, a fourth stage 116 and a fifth stage 118. The execution pipeline 104 includes multiple stages, shown here as a first stage 120, a second stage 122, a third stage 124 that includes an event detector 126, a fourth stage 128 and a fifth stage 130. The crossbar 106 includes an event counter 132.
As an instruction is executed in the pipeline stages of the execution pipelines 102, 104, a reportable event may occur in one of the pipeline stages. If a reportable event occurs, the event is detected by an event detector (e.g., event detector 114 or 126) and then communicated to the event counter 132 through a dedicated wire from the corresponding event detector to the event counter. When the API requests reporting of the event count, the value of the event counter 132 is written into a specified memory location.